/*
 * Created by Spear (http://www.codernet.es), spear@codernet.es
 * Coordinator of XNA Community (http://www.codeplex.com/XNACommunity)
 * 
 */

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using XMas;

namespace XMasContent
{
    [ContentTypeWriter]
    public class CSkeletonDataWriter : ContentTypeWriter<CSkeletonData>
    {
        protected override void Write(ContentWriter output, CSkeletonData value)
        {
            output.WriteObject(value.list_animations);
            //output.WriteObject(value.list_skeleton_mesh);
            output.WriteObject(value.worldModelTransform);
            output.WriteObject(value.bind_skeleton);
            output.WriteObject(value.inverse_bind_skeleton);
            output.WriteObject(value.tangents);
            output.WriteObject(value.binormals);
            output.WriteObject(value.normals);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(CSkeletonDataReader).AssemblyQualifiedName;
        }
    }


    [ContentTypeWriter]
    public class CAnimationDataWriter : ContentTypeWriter<CSkeletonData.CAnimationData>
    {
        protected override void Write(ContentWriter output, CSkeletonData.CAnimationData value)
        {
            output.WriteObject(value.frame_rate);
            output.WriteObject(value.list_frames);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(CAnimationDataReader).AssemblyQualifiedName;
        }
    }

    [ContentTypeWriter]
    public class CFramesDataWriter : ContentTypeWriter<CSkeletonData.CFramesData>
    {
        protected override void Write(ContentWriter output, CSkeletonData.CFramesData value)
        {
            output.WriteObject(value.list_skeleton);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(CFramesDataReader).AssemblyQualifiedName;
        }
    }

    [ContentTypeWriter]
    public class CSkeletonNodeWriter : ContentTypeWriter<CSkeletonData.CSkeletonNode>
    {
        protected override void Write(ContentWriter output, CSkeletonData.CSkeletonNode value)
        {
            output.WriteObject(value.pos);
            output.WriteObject(value.oriented);
            output.WriteObject(value.parent);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(CSkeletonNodeReader).AssemblyQualifiedName;
        }
    }
}
